package plyGo;

/**
 * Created by Administrator on 2016/12/7.
 */
public class plyGo {

    public static String  NOANYTHING = "";


    //累加正整数
    public static int Sum_Number(int...as){
        try {
            int i = 0;
            for(int b:as){
                i+=b;
            }
            return i;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  0;
    }

    //能否被2除尽
    public static boolean Is2SFriend(int a){
        try {
            if(a > 0 && (a&(a-1)) == 0 ){
                return true;
            }else{
                return  false;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  false;
    }

    //斐波排列
    public static int Fibonacci(int n){
        try {
            if(n == 1){
                return 1;
            }else if(n == 2){
                return 2;
            }else if(n>2){
                return Fibonacci(n-1)+Fibonacci(n-2);
            }else{
                return 0;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  0;
    }

}
